﻿#include <stdio.h>
#include<stdlib.h>
int main()
{
	int year;
	scanf("%d", &year);
	year--;
	printf("%d\n", (365 * year + year / 4 - year / 100 + year / 400 ) % 7+1);
	return 0;
}